package com.example.demo.serviceipml;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.example.demo.dao.UserDao;
import com.example.demo.entify.Role;
import com.example.demo.entify.User;
import com.example.demo.service.UserService;

@Service("userService")

public class UserServiceIpml implements UserService{
	@Autowired
	 private UserDao UserDao;
	
	@Override
	public User login(String username,String password) {
		
		return UserDao.login(username, password);
		
	}
	@Override 
	public int register(User user) {
			return UserDao.register(user);
	}
	
	public User isExist(String username) {
		 
		return UserDao.isExist1(username);
		
	}

	@Override
	 public User findByUsername(String username) {
	        return UserDao.isExist1(username);
	    }
	@Override
	public List<Role> Workers(Integer id) {
		// TODO Auto-generated method stub
		return UserDao.Workers(id);
	}
	@Override
	public int resetPass(User user) {
		// TODO Auto-generated method stub		
			return UserDao.resetPass(user);
	}
	@Override
	public int updatePass(User user) {
		// TODO Auto-generated method stub
		return UserDao.updatePass(user);
	}
	@Override
	public int updateWorkers(User user) {
		// TODO Auto-generated method stub
		return UserDao.updateWorkers(user);
	}

	@Override
	public int deleteUser(Integer id) {
		return UserDao.deleteUser(id);
	}

	@Override
	public int deleteByUid(Integer id) {
		return UserDao.deleteByUid(id);
	}
	@Override
	public int updateCustomer(User user) {
		// TODO Auto-generated method stub
		return UserDao.updateCustomer(user);
	}
	@Override
	public User userPower(Map<String, Object> params) {
		// TODO Auto-generated method stub
		return UserDao.userPower(params);
	}
	@Override
	public int updateUserstate(Integer userstate, String username) {
		// TODO Auto-generated method stub
		return UserDao.updateUserstate(userstate, username);
	}
	@Override
	public List<User> Users(Map<String, Object> params) {
		// TODO Auto-generated method stub
		return UserDao.Users(params);
	}

}
